using System;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Collections;
using System.Net.Security;

namespace Wicresoft.EKA.VCenter
{
    /// <summary>
    /// Summary description for CertPolicy.
    /// </summary>
    public static class CertPolicy
    {
        // Create a logger for use in this class
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        public static bool CheckValidationResult(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors == SslPolicyErrors.None)
                return true;
            if (((System.Net.HttpWebRequest)sender).Host == "192.168.85.155") return true;
            log.Error("Certificate error: " + sslPolicyErrors);

            // Do not allow this client to communicate with unauthenticated servers.
            return false;

        }
    }
}
